package taller2.controller.listeners.GraphCreator;

import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import taller2.view.draws.DrawingArea;

public class GraphCreatorSizeListener implements ChangeListener{
	private DrawingArea area;
	
	// constructor
	public GraphCreatorSizeListener(DrawingArea area){
		this.area = area;
	}
	
	// detects when user changes the size of the bar
	public void stateChanged(ChangeEvent e) {
		int tam = ((JSlider)e.getSource()).getValue();	
		area.resizeGraph(tam,tam/10 - 1,(float)(2*tam)/100);
	}
}
